﻿using MESPro.Enums;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MESPro.Models
{
    /// <summary>
    /// 用户信息表
    /// </summary>
    [Tenant("Default")]
    public class User : EntityBaseIdNameCreat
    {
        /// <summary>
        /// 用户编码,一般用于对接其他系统
        /// </summary>
        [SugarColumn(Length = 50)]
        public string? UserCode { get; set; } = "";
        /// <summary>
        /// 用户姓名
        /// </summary>
        [SugarColumn(Length = 50)]
        public string? UserName { get; set; }
        /// <summary>
        /// 用户密码,rs256等加密方式
        /// </summary>
        public string? PassWord { get; set; }
        /// <summary>
        /// 电话号码
        /// </summary>
        [SugarColumn(IsNullable = true, Length = 30)]
        public string? Photo { get; set; }
        /// <summary>
        /// 电话号码 IDCard
        /// </summary>
        [SugarColumn(IsNullable = true, Length = 30)]
        public string? Phone { get; set; }

        /// <summary>
        ///  ID号:一般指身份证号
        /// </summary>
        [SugarColumn(IsNullable = true, Length = 30)]
        public string? IDCard { get; set; }

        /// <summary>
        /// 表示这个用户拥有的所有角色
        /// </summary>
        [Navigate(typeof(UserRole), nameof(UserRole.UserId), nameof(UserRole.RoleId))]
        public List<Role> Roles { get; set; }
        /// <summary>
        /// 默认使用语言,不重要,实际使用可以更改
        /// </summary>
        public Language Language { get; set; }
        /// <summary>
        /// 状态1?不明白
        /// </summary>
        [SugarColumn(IsNullable = true, Length = 2)] 
        public string Status { get; set; }

        /// <summary>
        /// 登录状态?不明白
        /// </summary>
        [SugarColumn(IsNullable = true, Length = 10)]
        public string? LoginStatus { get; set; }
        /// <summary>
        /// 登录Ip
        /// </summary>
        [SugarColumn(IsNullable = true, Length = 30)]
        public string? LoginIp { get; set; }
        /// <summary>
        /// 登录Mac地址
        /// </summary>
        [SugarColumn(IsNullable = true, Length = 48)]
        public string? LoginMac { get; set; }
        /// <summary>
        /// 登录电脑的设备名字
        /// </summary>
        [SugarColumn(IsNullable = true, Length = 30)]
        public string? LoginComputerName { get; set; }
       

    }
}
